## Configuração para wiki.partidopirata.org
server {
  listen 80;
  listen [::]:80;
  server_name wiki.partidopirata.org;
  return 301 https://wiki.partidopirata.org$request_uri;
}
server {
  listen 80;
  listen [::]:80;
  server_name *.wiki.partidopirata.org;
  return 301 http://wiki.partidopirata.org$request_uri;
}

## SSL
server {
  listen 443 ssl;
  listen [::]:443 ssl;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;
  ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
  ssl_ecdh_curve secp384r1;
  ssl_session_cache shared:SSL:10m;
  ssl_session_tickets off;
  ssl_stapling on;
  ssl_stapling_verify on;
  resolver 208.67.220.220 208.67.222.222 valid=300s;
  resolver_timeout 5s;
  add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
  add_header X-Frame-Options SAMEORIGIN;
  add_header X-Content-Type-Options nosniff;
  ssl_certificate /etc/letsencrypt/live/partidopirata.org-0001/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/partidopirata.org-0001/privkey.pem;
  ssl_trusted_certificate /etc/letsencrypt/live/partidopirata.org-0001/chain.pem;

  server_name wiki.partidopirata.org;

  root /var/www/public_html/partidopirataxyz/;
  client_max_body_size 1228M;
  client_body_timeout 360s;

  location / {
    error_page 404 @ikiwiki404;
  }
  location ~ \.cgi {
    fastcgi_pass unix:/tmp/fcgi.socket;
    # Fastcgi parameters, include the standard ones
    include /etc/nginx/fastcgi_params;
    # Adjust non standard parameters (SCRIPT_FILENAME)
    fastcgi_param SCRIPT_FILENAME /var/www/public_html/partidopirataxyz/ikiwiki.cgi;
    fastcgi_param SCRIPT_NAME /ikiwiki.cgi;
    fastcgi_param AUTH_USER $remote_user;
    fastcgi_param REMOTE_USER $remote_user;
    fastcgi_index ikiwiki.cgi;
    fastcgi_param DOCUMENT_ROOT /var/www/public_html/partidopirataxyz/;
    fastcgi_read_timeout 300;
  }
  location @ikiwiki404 {
    fastcgi_pass unix:/tmp/fcgi.socket;
    fastcgi_index ikiwiki.cgi;
    fastcgi_param DOCUMENT_ROOT /var/www/public_html/partidopirataxyz/;
    fastcgi_param SCRIPT_FILENAME /var/www/public_html/partidopirataxyz/ikiwiki.cgi;
    fastcgi_param QUERY_STRING "";
    fastcgi_param REQUEST_METHOD "get";
    fastcgi_param REDIRECT_STATUS 404;
    fastcgi_param REDIRECT_URL $uri;
    include /etc/nginx/fastcgi_params;
  }
}

## Tor
server {
  listen 127.0.0.1:42914;
  allow 127.0.0.1;
  deny all;

  add_header X-Frame-Options SAMEORIGIN;
  add_header X-Content-Type-Options nosniff;

  server_name wikibvg7ty3xsboc.onion;

  root /var/www/public_html/partidopirataxyz/;
  client_max_body_size 1228M;
  client_body_timeout 360s;

  location / {
    error_page 404 @ikiwiki404;
  }
  location ~ \.cgi {
    fastcgi_pass unix:/tmp/fcgi.socket;
    # Fastcgi parameters, include the standard ones
    include /etc/nginx/fastcgi_params;
    # Adjust non standard parameters (SCRIPT_FILENAME)
    fastcgi_param SCRIPT_FILENAME /var/www/public_html/partidopirataxyz/ikiwiki.cgi;
    fastcgi_param SCRIPT_NAME /ikiwiki.cgi;
    fastcgi_param AUTH_USER $remote_user;
    fastcgi_param REMOTE_USER $remote_user;
    fastcgi_index ikiwiki.cgi;
    fastcgi_param DOCUMENT_ROOT /var/www/public_html/partidopirataxyz/;
    fastcgi_read_timeout 300;
  }
  location @ikiwiki404 {
    fastcgi_pass unix:/tmp/fcgi.socket;
    fastcgi_index ikiwiki.cgi;
    fastcgi_param DOCUMENT_ROOT /var/www/public_html/partidopirataxyz/;
    fastcgi_param SCRIPT_FILENAME /var/www/public_html/partidopirataxyz/ikiwiki.cgi;
    fastcgi_param QUERY_STRING "";
    fastcgi_param REQUEST_METHOD "get";
    fastcgi_param REDIRECT_STATUS 404;
    fastcgi_param REDIRECT_URL $uri;
    include /etc/nginx/fastcgi_params;
  }
}

